import { Component } from 'react'
import Son from './compentens/子组件'
class App extends Component {
  state = {
    // 需求：老子给儿子遗产：100W， 儿子想财务自由：子组件每次点击基于100w随机增加
    money: 1e6,
  }
  add = (sky) => {
    this.setState({
      // money: this.state.money + Math.random() * 100,
      money: this.state.money + sky,
    })
  }
  render() {
    return (
      <div>
        <h1>父组件</h1>
        <hr />
        <Son money={this.state.money} change={this.add} />
      </div>
    )
  }
}

export default App
